$(function() {

	$('#li_sys').addClass('active open');
	$('#backupconfig').addClass('active');

	$("#saveconfig").click(function() {
		var project = $("#project").val();
		var localpath = $("#localpath").val();
		var sourceip = $("#sourceip").val();
		var sourcepath = $("#sourcepath").val();
		var namerule = $("#namerule").val();
		var clean = $("#clean").val();

		$.ajax({
			type : 'post',
			url : 'backconfig/insert',
			dataType : 'text',
			data : {
				"project" : project,
				"localpath" : localpath,
				"sourceip" : sourceip,
				"sourcepath" : sourcepath,
				"namerule" : namerule,
				"clean" : clean
			},
			success : function(msg) {
				console.log(msg);
				if (msg == "1") {
					alert("录入成功");// use modal instead after

					$("#project").val('');
					$("#localpath").val('');
					$("#sourceip").val('');
					$("#sourcepath").val('');
					$("#namerule").val('');
					$("#clean").val('');

				} else {
					alert("录入失败");
				}
			},
			error : function(msg) {
				console.log('failed')
			}
		});

	});

});